﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.UI.HtmlControls;

public partial class Controls_Connect : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            connectNick.Text = GetNicks();
        }
    }
    private string GetNicks()
    {
        if (HttpContext.Current.Cache["YHNick"] != null)
            return (string)HttpContext.Current.Cache["YHNick"];
        else
        {
            string str = "";

            string temp = "<a href='ymsgr:sendIM?{0}'><img src='http://opi.yahoo.com/online?u={0}&m=g&t=2&l=us' alt =''/></a>";

            string sNick = System.Configuration.ConfigurationManager.AppSettings["YHNicks"];

            if (!string.IsNullOrEmpty(sNick))
            {

                string[] nickArray = sNick.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in nickArray)
                {
                    str += temp.Replace("{0}", s) + "<br>";
                }

            }
            HttpContext.Current.Cache.Insert("YHNick", str);
            return str;
        }
    }
}
